public class 匿名类 {


    public static void main(String[] args) {
        A a = new A(){
            @Override
            public void print() {
                System.out.println("hahaha");
            }
        };

        B b = new B(){

            @Override
            public void add() {
                System.out.println("BBBBBBBBBB");
            }
        };

        a.print();
        b.add();
    }
}

//接口
interface A{
    public void print();
}

//抽象类
abstract class B{

    public abstract void add();

        }